
const reverseList = (head) => {
  let pre = null,
      next = null
  while (head !== null) {
    next = head.next
    head.next = pre
    pre = head
    head = next
  }
  return pre
}